.class public abstract Lcom/vividsolutions/jts/algorithm/LineIntersector;
.super Ljava/lang/Object;
.source "LineIntersector.java"


# instance fields
.field protected inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

.field protected intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

.field protected isProper:Z

.field protected pa:Lcom/vividsolutions/jts/geom/Coordinate;

.field protected pb:Lcom/vividsolutions/jts/geom/Coordinate;

.field protected precisionModel:Lcom/vividsolutions/jts/geom/PrecisionModel;

.field protected result:I


# direct methods
.method public constructor <init>()V
    .locals 4

    .line 149
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x2

    .line 132
    filled-new-array {v0, v0}, [I

    move-result-object v1

    const-class v2, Lcom/vividsolutions/jts/geom/Coordinate;

    invoke-static {v2, v1}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, [[Lcom/vividsolutions/jts/geom/Coordinate;

    iput-object v1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    .line 133
    new-array v0, v0, [Lcom/vividsolutions/jts/geom/Coordinate;

    iput-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    const/4 v0, 0x0

    .line 146
    iput-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->precisionModel:Lcom/vividsolutions/jts/geom/PrecisionModel;

    .line 150
    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    new-instance v1, Lcom/vividsolutions/jts/geom/Coordinate;

    invoke-direct {v1}, Lcom/vividsolutions/jts/geom/Coordinate;-><init>()V

    const/4 v2, 0x0

    aput-object v1, v0, v2

    .line 151
    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    new-instance v1, Lcom/vividsolutions/jts/geom/Coordinate;

    invoke-direct {v1}, Lcom/vividsolutions/jts/geom/Coordinate;-><init>()V

    const/4 v3, 0x1

    aput-object v1, v0, v3

    .line 153
    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v1, v0, v2

    iput-object v1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->pa:Lcom/vividsolutions/jts/geom/Coordinate;

    .line 154
    aget-object v0, v0, v3

    iput-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->pb:Lcom/vividsolutions/jts/geom/Coordinate;

    .line 155
    iput v2, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    return-void
.end method

.method public static computeEdgeDistance(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)D
    .locals 13

    .line 84
    iget-wide v0, p2, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v2, p1, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double/2addr v0, v2

    invoke-static {v0, v1}, Ljava/lang/Math;->abs(D)D

    move-result-wide v0

    .line 85
    iget-wide v2, p2, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v4, p1, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double/2addr v2, v4

    invoke-static {v2, v3}, Ljava/lang/Math;->abs(D)D

    move-result-wide v2

    .line 88
    invoke-virtual {p0, p1}, Lcom/vividsolutions/jts/geom/Coordinate;->equals(Ljava/lang/Object;)Z

    move-result v4

    const-wide/16 v5, 0x0

    if-eqz v4, :cond_0

    move-wide v0, v5

    goto :goto_1

    .line 91
    :cond_0
    invoke-virtual {p0, p2}, Lcom/vividsolutions/jts/geom/Coordinate;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-eqz p2, :cond_2

    cmpl-double p2, v0, v2

    if-lez p2, :cond_1

    goto :goto_1

    :cond_1
    move-wide v0, v2

    goto :goto_1

    .line 98
    :cond_2
    iget-wide v7, p0, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v9, p1, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double/2addr v7, v9

    invoke-static {v7, v8}, Ljava/lang/Math;->abs(D)D

    move-result-wide v7

    .line 99
    iget-wide v9, p0, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v11, p1, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double/2addr v9, v11

    invoke-static {v9, v10}, Ljava/lang/Math;->abs(D)D

    move-result-wide v9

    cmpl-double p2, v0, v2

    if-lez p2, :cond_3

    move-wide v0, v7

    goto :goto_0

    :cond_3
    move-wide v0, v9

    :goto_0
    cmpl-double p2, v0, v5

    if-nez p2, :cond_4

    .line 106
    invoke-virtual {p0, p1}, Lcom/vividsolutions/jts/geom/Coordinate;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-nez p2, :cond_4

    .line 108
    invoke-static {v7, v8, v9, v10}, Ljava/lang/Math;->max(DD)D

    move-result-wide v0

    :cond_4
    :goto_1
    cmpl-double p2, v0, v5

    if-nez p2, :cond_6

    .line 111
    invoke-virtual {p0, p1}, Lcom/vividsolutions/jts/geom/Coordinate;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_5

    goto :goto_2

    :cond_5
    const/4 p0, 0x0

    goto :goto_3

    :cond_6
    :goto_2
    const/4 p0, 0x1

    :goto_3
    const-string p1, "Bad distance calculation"

    invoke-static {p0, p1}, Lcom/vividsolutions/jts/util/Assert;->isTrue(ZLjava/lang/String;)V

    return-wide v0
.end method

.method private getTopologySummary()Ljava/lang/String;
    .locals 2

    .line 231
    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    .line 232
    invoke-virtual {p0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isEndPoint()Z

    move-result v1

    if-eqz v1, :cond_0

    const-string v1, " endpoint"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 233
    :cond_0
    iget-boolean v1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isProper:Z

    if-eqz v1, :cond_1

    const-string v1, " proper"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 234
    :cond_1
    invoke-virtual {p0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isCollinear()Z

    move-result v1

    if-eqz v1, :cond_2

    const-string v1, " collinear"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 235
    :cond_2
    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


# virtual methods
.method protected abstract computeIntersect(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)I
.end method

.method public computeIntersection(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)V
    .locals 4

    .line 200
    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    const/4 v1, 0x0

    aget-object v2, v0, v1

    aput-object p1, v2, v1

    .line 201
    aget-object v2, v0, v1

    const/4 v3, 0x1

    aput-object p2, v2, v3

    .line 202
    aget-object v2, v0, v3

    aput-object p3, v2, v1

    .line 203
    aget-object v0, v0, v3

    aput-object p4, v0, v3

    .line 204
    invoke-virtual {p0, p1, p2, p3, p4}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->computeIntersect(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)I

    move-result p1

    iput p1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    return-void
.end method

.method public getEdgeDistance(II)D
    .locals 3

    .line 388
    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object p2, v0, p2

    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v1, v0, p1

    const/4 v2, 0x0

    aget-object v1, v1, v2

    aget-object p1, v0, p1

    const/4 v0, 0x1

    aget-object p1, p1, v0

    invoke-static {p2, v1, p1}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->computeEdgeDistance(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)D

    move-result-wide p1

    return-wide p1
.end method

.method public getIntersection(I)Lcom/vividsolutions/jts/geom/Coordinate;
    .locals 1

    .line 263
    iget-object v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object p1, v0, p1

    return-object p1
.end method

.method public getIntersectionNum()I
    .locals 1

    .line 254
    iget v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    return v0
.end method

.method public hasIntersection()Z
    .locals 1

    .line 248
    iget v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method protected isCollinear()Z
    .locals 2

    .line 189
    iget v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    const/4 v1, 0x2

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method protected isEndPoint()Z
    .locals 1

    .line 239
    invoke-virtual {p0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->hasIntersection()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-boolean v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isProper:Z

    if-nez v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method public isInteriorIntersection()Z
    .locals 3

    const/4 v0, 0x0

    .line 298
    invoke-virtual {p0, v0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isInteriorIntersection(I)Z

    move-result v1

    const/4 v2, 0x1

    if-eqz v1, :cond_0

    return v2

    .line 299
    :cond_0
    invoke-virtual {p0, v2}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isInteriorIntersection(I)Z

    move-result v1

    if-eqz v1, :cond_1

    return v2

    :cond_1
    return v0
.end method

.method public isInteriorIntersection(I)Z
    .locals 5

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 310
    :goto_0
    iget v2, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    if-ge v1, v2, :cond_1

    .line 311
    iget-object v2, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v2, v2, v1

    iget-object v3, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v3, v3, p1

    aget-object v3, v3, v0

    invoke-virtual {v2, v3}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v2

    if-nez v2, :cond_0

    iget-object v2, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v2, v2, v1

    iget-object v3, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v3, v3, p1

    const/4 v4, 0x1

    aget-object v3, v3, v4

    invoke-virtual {v2, v3}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v2

    if-nez v2, :cond_0

    return v4

    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    return v0
.end method

.method public isIntersection(Lcom/vividsolutions/jts/geom/Coordinate;)Z
    .locals 3

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 283
    :goto_0
    iget v2, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->result:I

    if-ge v1, v2, :cond_1

    .line 284
    iget-object v2, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->intPt:[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v2, v2, v1

    invoke-virtual {v2, p1}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v2

    if-eqz v2, :cond_0

    const/4 p1, 0x1

    return p1

    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    return v0
.end method

.method public isProper()Z
    .locals 1

    .line 334
    invoke-virtual {p0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->hasIntersection()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-boolean v0, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isProper:Z

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method

.method public setPrecisionModel(Lcom/vividsolutions/jts/geom/PrecisionModel;)V
    .locals 0

    .line 175
    iput-object p1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->precisionModel:Lcom/vividsolutions/jts/geom/PrecisionModel;

    return-void
.end method

.method public toString()Ljava/lang/String;
    .locals 5

    .line 224
    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    iget-object v1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    const/4 v2, 0x0

    aget-object v3, v1, v2

    aget-object v3, v3, v2

    aget-object v1, v1, v2

    const/4 v4, 0x1

    aget-object v1, v1, v4

    invoke-static {v3, v1}, Lcom/vividsolutions/jts/io/WKTWriter;->toLineString(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    const-string v1, " - "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    iget-object v1, p0, Lcom/vividsolutions/jts/algorithm/LineIntersector;->inputLines:[[Lcom/vividsolutions/jts/geom/Coordinate;

    aget-object v3, v1, v4

    aget-object v2, v3, v2

    aget-object v1, v1, v4

    aget-object v1, v1, v4

    invoke-static {v2, v1}, Lcom/vividsolutions/jts/io/WKTWriter;->toLineString(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    invoke-direct {p0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->getTopologySummary()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
